package com.hzhr.iot.statis.dao;

import com.hzhr.iot.statis.dao.mapper.custom.GasUserDailyGasConsumeEntityCustomMapper;
import com.hzhr.iot.statis.dao.mapper.generator.GasUserDailyGasConsumeEntityMapper;
import com.hzhr.iot.statis.entity.GasUserDailyGasConsumeEntity;
import com.hzhr.iot.statis.entity.ext.GasUserDailyGasConsumeEntityExt;
import com.hzhr.iot.statis.queryModel.custom.GasUserDailyGasConsumeCustomQueryModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class GasUserDailyGasConsumeDao {
    @Autowired
    GasUserDailyGasConsumeEntityMapper gasUserDailyGasConsumeEntityMapper;
    @Autowired
    GasUserDailyGasConsumeEntityCustomMapper gasUserDailyGasConsumeEntityCustomMapper;

    public int insert(GasUserDailyGasConsumeEntity record) {
        if (record == null) return 0;
        int changeCount = gasUserDailyGasConsumeEntityMapper.insert(record);
        return changeCount;
    }

    public int delete(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return 0;
        int changeCount = gasUserDailyGasConsumeEntityCustomMapper.delete(queryModel);
        return changeCount;
    }

    public int update(GasUserDailyGasConsumeEntity record) {
        if (record == null) return 0;
        int changeCount = gasUserDailyGasConsumeEntityMapper.updateByPrimaryKey(record);
        return changeCount;
    }

    public int updateProps(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return 0;
        int changeCount = gasUserDailyGasConsumeEntityCustomMapper.updateProps(queryModel);
        return changeCount;
    }

    public GasUserDailyGasConsumeEntity selectEntity(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return null;
        List<GasUserDailyGasConsumeEntityExt> extList = gasUserDailyGasConsumeEntityCustomMapper.selectExt(queryModel);
        if (extList == null || extList.size() == 0) return null;
        return extList.get(0);
    }
    public List<GasUserDailyGasConsumeEntity> selectEntityList(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return null;
        List<GasUserDailyGasConsumeEntityExt> extList = gasUserDailyGasConsumeEntityCustomMapper.selectExt(queryModel);
        if (extList == null) return null;
        List<GasUserDailyGasConsumeEntity> entityList = new ArrayList<>();
        for (GasUserDailyGasConsumeEntityExt ext : extList) {
            entityList.add(ext);
        }
        return entityList;
    }
    public GasUserDailyGasConsumeEntityExt selectExt(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return null;
        List<GasUserDailyGasConsumeEntityExt> extList = gasUserDailyGasConsumeEntityCustomMapper.selectExt(queryModel);
        if (extList == null || extList.size() == 0) return null;
        return extList.get(0);
    }
    public List<GasUserDailyGasConsumeEntityExt> selectExtList(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return null;
        List<GasUserDailyGasConsumeEntityExt> extList = gasUserDailyGasConsumeEntityCustomMapper.selectExt(queryModel);
        return extList;
    }

    public int selectCount(GasUserDailyGasConsumeCustomQueryModel queryModel) {
        if (queryModel == null) return 0;
        int count = gasUserDailyGasConsumeEntityCustomMapper.selectCount(queryModel);
        return count;
    }
}
